home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16843 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: grimsel.zurich.ibm.com!usenet
  2. From: Keith Whittingham <wgk@zurich.ibm.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help! Macro replacement......
  5. Date: Fri, 12 Apr 1996 10:27:26 -0700
  6. Organization: IBM Zurich Research Laboratory
  7. Message-ID: <316E927E.4D4C@zurich.ibm.com>
  8. References: <4kega2$1tk@hptemp1.cc.umr.edu>
  9. NNTP-Posting-Host: pine.zurich.ibm.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (Win16; I)
  14.  
  15. re:
  16.  
  17.    #define ABS(X) ((X <= 0) ? -X : X)
  18.  
  19.    int y = ABS(-6+4);
  20.  
  21.      y = - - 6 + 4;
  22. or:  y = --6 + 4;
  23.  
  24.  
  25. I'm not sure that it is explicitly defined (although I may well
  26. be wrong - I haven't looked very hard.
  27.  
  28. What I would assume is that the pre-processor is assumed to output
  29. to the compiler and so two minus-signs adjacent to each other
  30. should decrement and the code should produce an error.
  31.  
  32. In summary I'd be happy with the compiler that produces an error
  33. cause thats a difficult bug to find...
  34.  
  35. -- 
  36. Keith Whittingham
  37. wgk@zurich.ibm.com
  38.